import {ActivatedRouteSnapshot, CanDeactivate, RouterStateSnapshot} from "@angular/router";
import {Product2Component} from "../product2/product2.component";
import {Observable} from "rxjs/Observable";

export class UnsavedGuard implements CanDeactivate<Product2Component>{
  canDeactivate(component: Product2Component, route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean>|Promise<boolean>|boolean {
    return window.confirm("你还没有保存，确定要离开吗？");
  }
}
